<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			var str1 = "hello world";
			var str2 = new String("hello js");
			// length属性，返回字符串的长度
			console.log(str1.length);
			console.log(str2.length);
			// 大小写转换
			console.log(str1.toUpperCase());
			console.log(str1.toLowerCase());
			// 获取指定字符：
			var ch = str1.charAt(6); 
			console.log(ch);// w
			console.log(str1.charAt(6));// w
			// indexOf
			var str = "Hello JS and Java";
			console.log(str.indexOf("JS"));// 6
			console.log(str.indexOf("JS", 9));// -1
			console.log(str.lastIndexOf("JS"));// 6
			// split 分割
			var str3 = "how are you doing today?";
			var array = str3.split(" ");
			console.log(array);//["how", "are", "you", "doing", "today?"]
			console.log(array[1]);// are
			console.log("2:3:4:5".split(":"))//["2", "3", "4", "5"]
			console.log("2:3:4:5".split(":", 3))//["2", "3", "4"]
		</script>
	</body>
</html>
